package com.gusto.engine.recommend.prediction;

import org.apache.log4j.Logger;

import com.gusto.engine.colfil.Prediction;
import com.gusto.engine.recommend.PredictionService;
import com.gusto.engine.recommend.prediction.base.BaseImpl;

/**
 * <p>Default rating algorithm, always returns the same defined value.</p>
 * 
 * @author amokrane.belloui@gmail.com
 *
 */
public class DefaultRatingImpl extends BaseImpl implements PredictionService {
	
	private Logger log = Logger.getLogger(getClass());
	
	private Double defaultValue = 2.5;
	public void setDefaultValue(Double defaultValue) {
		this.defaultValue = defaultValue;
	}


	public Prediction predict(long userId, long itemId, boolean includePrediction) {
		long start = System.currentTimeMillis();
		
		Double val = this.defaultValue;
		
		log.debug("Default rating prediction " + this.defaultValue);
		
		logPrediction(0, 0, 0, (System.currentTimeMillis() - start), "PPPP");
		return returnPrediction(userId, itemId, val);
	}

}
